package com.laivi.basic.module.orm;

import java.util.List;

import com.laivi.basic.model.datastruct.ValueMap;
import com.laivi.basic.model.orm.Cnd;
import com.laivi.basic.model.sql.Page;

/**
 * @author laivi.zhu@gmail.com
 * @date 2014-7-5
 * description:
 */
public interface EntityDao {

	public <T> void add(T entity);
	
	public <T> long insert(T entity);
	
	public <T> void update(T entity);
	
	public <T> void delete(T entity);
	
	public <T> void delete(long id,Class<T> klass);
	
	public <T> T get(long id,Class<T> klass);
	
	public <T> T get(Cnd cnd,Class<T> klass);
	
	public <T> List<T> query(Cnd cnd,Class<T> klass);
	
	public <T> Page<T> query(Cnd cnd,Class<T> klass,int pageNum,int pageSize);
	
	public <T> int count(Cnd cnd,Class<T> klass);
	
	public <T> Object fun(String fun,String field,Cnd cnd,Class<T> klass);
	
	public <T> T orm(ValueMap value,Class<T> klass);
	
	public <T> List<T> orm(List<ValueMap> values,Class<T> klass);
	
	public <T> Page<T> orm(Page<ValueMap> values,Class<T> klass);
	
	public <T> ValueMap mor(T obj);
	
	public void create(String packageName);
	
	public <T> boolean exist(Class<T> klass);
	
	public <T> void create(Class<T> klass);
	
	public <T> void drop(Class<T> klass);
	
	public <T> void truncate(Class<T> klass);
	
	public <T> void alert(Class<T> klass);
}
